Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Working With Sound

The following calls operate on the static 3D sound setting for a track. By constantly setting the value it is possible for an application to make a track's sound move in 3D space. If it is necessary to store dynamically changing 3D sound settings for the track, this can be done using the modifier track mechanism in conjunction with a tween track. This process is described in the following section.

SetTrackSoundLocalizationSettings

SetTrackSoundLocalizationSettings replaces the current 3D sound settings for the specified track with the new SSpLocalizationData record contained in the settings handle. The effect of the new 3D sound setting takes place immediately. This call always stores the new record passed, even if the track or the computer is not capable of actually meeting the request. You can pass a nil handle to indicate that no 3D sound effects should be used for this track. When the movie is saved, the 3D sound settings is saved with it.

SetTrackSoundLocalizationSettings makes a copy of the handle passed, so the caller is responsible for disposing of the settings handle.

pascal OSErr SetTrackSoundLocalizationSettings (
                     Track theTrack,
                     Handle settings)
theTrack
Identifies the track for this operation. Your application obtains this track identifier from such toolbox functions as NewMovieTrack and GetMovieTrack .

settings
The settings you want to apply, in the format of a sound sprockets SSpLocalizationData record.

The following example code shows how to set the static 3D sound setting for a track using SetTrackSoundLocalizationSettings .

void setTrackSoundLocalization(Track t)
{
    SSpLocalizationData loc;
    Handle h;
    OSErr err;

    loc.cpuLoad = 0;
    loc.medium = kSSpMedium_Air;
    loc.humidity = 0;
    loc.roomSize = 250;
    loc.roomReflectivity = -5;
    loc.reverbAttenuation = -5;
    loc.sourceMode = kSSpSourceMode_Localized;
    loc.referenceDistance = 1;
    loc.coneAngleCos = 0;
    loc.coneAttenuation = 0;
    loc.currentLocation.elevation = 0;
    loc.currentLocation.azimuth = 0;
    loc.currentLocation.distance = 2;
    loc.currentLocation.projectionAngle = 0;
    loc.currentLocation.sourceVelocity = 0;
    loc.currentLocation.listenerVelocity = 0;
    loc.reserved0 = 0;
    loc.reserved1 = 0;
    loc.reserved2 = 0;
    loc.reserved3 = 0;
    loc.virtualSourceCount = 0;

    err = PtrToHand(&loc, &h, sizeof(loc));
    err = SetTrackSoundLocalizationSettings(t, h);
    DisposeHandle(h);
}

GetTrackSoundLocalizationSettings

GetTrackSoundLocalizationSettings returns a handle containing a copy of the current 3D sound settings for the specified track.

pascal OSErr GetTrackSoundLocalizationSettings (
                     Track theTrack,
                     Handle *settings)
theTrack
Identifies the track for this operation. Your application obtains this track identifier from such toolbox functions as NewMovieTrack and GetMovieTrack .

settings
The settings you want to retrieve, in the format of a sound sprockets SSpLocalizationData record.

Discussion

If there are no 3D sound settings, the returned handle is set to nil . The caller of this function is responsible for disposing of the returned handle.


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |